<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <!--{include file='comm/header.tpl'}-->
    <title><!--{if $tagGroupInfo->tagGroupID !='' }-->修改标签组<!--{else}-->添加标签组<!--{/if}--></title>
</head>

<body>
<div style="width:100%">

    <div class="items clearfix">
        <h2 style="" class="tal">正在操作：<!--{if $tagGroupInfo->tagGroupID !='' }-->修改标签组<!--{else}-->添加标签组<!--{/if}--></h2>
        <div class="items2">
            <!--{if $error_msg}-->
	            <div class="error-box">
	                <!--{$error_msg}-->
	            </div>
            <!--{else}-->
            <div>
                <form id="tagGroup_form" onsubmit="return false;">
                    <table>
                        <tbody>
                        <tr>
                            <td class="tar" width="150">标签组名称：</td>
                            <td width="400">
                            	<input type="text" style="ime-mode:active;width:300px;" autocomplete="off"  name="tagGroupName" id="tagGroupName" maxlength="20" value="<!--{$tagGroupInfo->tagGroupName}-->">
                                <font color="red">*</font>
                                 <input type="hidden" name="tagGroupID" id="tagGroupID" value="<!--{$tagGroupInfo->tagGroupID}-->" />
                            </td>
                        </tr>
                        <tr>
                            <td class="tar" width="150">标签组别名：</td>
                            <td width="400">
                            	<input type="text" style="ime-mode:active;width:300px;" autocomplete="off"  name="memoName" id="memoName" maxlength="20" value="<!--{$tagGroupInfo->memoName}-->">
                                <font color="red">*</font>
                            </td>
                        </tr>
                         <tr>
                            <td class="tar">排列序号：</td>
                            <td>
                            	<input type="text" style="ime-mode:active;width:80px;" autocomplete="off"  name="sortOrder" id="sortOrder" maxlength="6" value="<!--{$tagGroupInfo->sortOrder}-->">
                                <font color="red">*</font>
                            </td>
                        </tr>
                        <tr>
                            <td class="tar" >使用标志：</td>
                            <td>
                            	<!--{if $tagGroupInfo->useFlg ==1 }-->
	                            	<input type="radio" checked="checked" value="1" name="useFlg">启用 
	                            	<input type="radio" name="useFlg" value="0">禁用 
                            	<!--{else}-->
                            		<input type="radio"  value="1" name="useFlg">启用 
	                            	<input type="radio" checked="checked" name="useFlg" value="0">禁用 
                            	<!--{/if}-->
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <!--{/if}-->

        </div>
    </div>

    <div class="bottom_fixbox">
        <div class="rectbox tac">
        	<input type="button" class="btn" onclick="tagGroup.reset();" value="重置" />&nbsp;&nbsp;&nbsp;
        	<input type="button" class="btn" onclick="tagGroup.check();" value="<!--{if $tagGroupInfo->tagGroupID !='' }-->修改标签组<!--{else}-->添加标签组<!--{/if}-->" />&nbsp;&nbsp;&nbsp;
            <input type="button" class="btn" onclick="E.closeWindows();" value="关闭" />
        </div>
    </div>



</div>

<script type="text/javascript">
    var tagGroup = {
    	
        tagGroupID: <!--{$tagGroupInfo->tagGroupID|default:0}-->,
        //检查数据
        check: function() {
            this.dt = E.getFormValues("tagGroup_form");
            var error_msg = "";
             
            if (this.dt.tagGroupName == "")
                error_msg += "标签组名称不能为空<br />";
                
            if (this.dt.memoName == "")
                error_msg += "标签组别名不能为空<br />";
                
            if (!E.isInt(this.dt.sortOrder))
                error_msg += "排序序号必须为数字<br />";
                
            if (error_msg != "")
                E.alert(error_msg);
            else
            	tagGroup.add() ;
        },

        //保存标签组信息
        add: function() {
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/goods/tagGroup.ajax?operFlg=2" ,
                dataType: "JSON",
                data: this.dt,
                success: function( result_obj ) {
                    if (result_obj.code == 200) {
                        if(tagGroup.tagGroupID == 0){
                        	E.opener("tagGroup.load");
                        	E.alert(result_obj.message, 2);
                        	self.location = "/quanliadmin/app/goods/tagGroup.pscript?operFlg=2" ;
                        }else{
                        	E.alert(result_obj.message, 2, "E.closeWindows");
                        	E.opener("tagGroup.load");
                        }
                    } else {
                        E.alert(result_obj.message);
                    }
                }
            });
        },

        //清除商品信息
        reset: function() {
            $("#tagGroupName").val("");
            $("#memoName").val("");
            $('input[name=useFlg]').get(0).checked = true;
        },

    };
    
	
</script>
</body>
</html>